Divide and Conquer
Let’s explore the benefits of the divide and conquer strategy.
We'll cover the following
Overview#
This chapter will analyze software design principles that are collectively known as clean architecture. But before we dive into the implementation of these principles, which is the central concern of this course, we need to analyze the structure and components of systems with clean architecture a bit more deeply.
Before we dive into a possible implementation of them, which is the core of this course, we need to analyze more in-depth the structure of the clean architecture and the components we can find in the system designed following it.
Role of layered architecture#
One of the main goals of a well-designed system is to achieve control. From this point of view, a software system is not different from a workplace, like in an office or a factory. In these environments, workers exchange data or physical objects to create or deliver a final product, which may be an object or a service. The workers need information and resources to perform their job, but most of all, they need to have a clear picture of their responsibilities.
Human and machine#
In our society, we value initiative and creativity. On the other hand, we don’t expect the components in a machine, such as a software system, to be able to do anything that isn’t clearly stated when the system is designed. Software isn’t alive, and despite the impressive achievements of artificial intelligence in recent years, it can’t demonstrate the agency or initiative of a human being.
Whatever our position on AI may be, we all likely can agree that a system works better if the responsibilities of its components are clearly outlined. Whether it’s software or our own communities, it’s always risky when what a component can or must do is unclear, since areas of influence and control naturally overlap. This can lead to all sorts of issues, from simple inefficiencies to complete deadlocks.
A good way to improve order and control in a system is to split it into subsystems. It’s important to establish clear and distinct borders between these subsystems to regulate data exchange. This is an extension of the political concept of “divide and conquer,” which states that it’s much simpler to rule a set of small interconnected systems than a single complex one.
The nature of machine#
In the system we designed in the lesson “The Data Flow”, it’s always clear what a component expects to receive when it’s called into play, and it’s also impossible (or at least not allowed) to exchange data in a way that breaks the structure of the system.
We have to remember that a software system is not the same as a factory or an office. Whenever we discuss machines, we have to consider both the way they work at runtime as well as how they’re built and modified during development. In principle, computers don’t care about where data comes from or where it goes. People, on the other hand, who are the ones that build and maintain the system, need a clear picture of the data flow in order to avoid bugs or affecting its performance.
Quiz
Data Types